<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require_once 'db_conn.php';
$id=  isset($_GET['id'])?$_GET['id']:0;

$username=$_POST['username'];

 $message=$_POST['message'];
 $sex=$_POST['sex'];
 $imgurl=$_POST['imgurl'];
 //写sql

 $sql="UPDATE  t_message SET username='$username',message='$message',sex='$sex',imgurl='$imgurl'WHERE id='$id' ";

 $result=$db->query($sql); 

 if ($result)

    {
        echo "<script language='javascript' type='text/javascript'>";
        echo "alert('修改成功');";
        echo "window.location.href='index.php'";
        echo "</script>";
    }
 else 
    {
        echo "<script language='javascript' type='text/javascript'>";
        echo "alert('修改失败！');";
        echo "window.location.href='index.php'";
        echo "</script>";
    }
   // require_once 'xiu_html.php';